/*
 * Config.h
 *
 *  Created on: 01.01.2012
 *      Author: mario
 */

#ifndef CONFIG_H_
#define CONFIG_H_

#include <string.h>
#include <boost/utility.hpp>
#include <boost/property_tree/ptree.hpp>

using namespace std;
using boost::property_tree::ptree;

class Config : public boost::noncopyable
{
public:
    typedef Config self;
    
    static self& instance()
    {
        static self instance;
        return instance;
    }

    void read(const string& path);
//    void save(string path);
//    void save();
//    
    string get(const string& key);
    int get_int(const string& key);

    
    string get_ariba_endpoints();
    ptree get_ariba_bootstrap_hints();
    
    
    // some static convenience functions
    static bool compare_case_insensitive(const string& str1, const string& str2);
    static bool is_yes(const string& str);
    static bool is_no(const string& str);
    
private:
    Config();
    virtual ~Config();
    
    void convert_input();

    
private:
    ptree config_pt;
    ptree default_pt;
    string path;
};

#endif /* CONFIG_H_ */
